Taxonomy table QA fixes#3000
Conversation
|
Thanks for the pull request, @jesperhodge! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
tbain
left a comment
There was a problem hiding this comment.
I appreciate modularizing some of this logic :) Approved
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3000 +/- ##
==========================================
+ Coverage 95.46% 95.47% +0.01%
==========================================
Files 1378 1383 +5
Lines 32596 32642 +46
Branches 7495 7498 +3
==========================================
+ Hits 31117 31165 +48
+ Misses 1410 1408 -2
Partials 69 69 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5b23b51 to
a44a221
Compare
brian-smith-tcril
left a comment
There was a problem hiding this comment.
Overall this looks great!
I left a few comments in there, mostly just general cleanup suggestions.
I also asked claude to take a look and it called out something I hadn't thought about. I don't think it's something I'm concerned about but I figured I'd share:
DraftRow(intree-table/) importsUsageCountDisplayfromtag-list/, whiletag-list/already imports fromtree-table/. This creates a bidirectional dependency between the two directories —tree-tableis meant to be the generic table layer but now has a direct dependency on atag-list-specific component. CouldUsageCountDisplaymove intotree-table/, or couldDraftRowaccept it as a render prop instead?
| } catch (err) { | ||
| throw new Error(getApiErrorMessage(err, intl)); | ||
| } |
There was a problem hiding this comment.
Is moving away from the catch/rethrow pattern desired for more than just these functions? Not something I would want to block this PR on, but if we're moving away from that it'd be good to make a follow-up issue to rework the rest of the places the catch/rethrow pattern is used in this file and no longer need to import getApiErrorMessage.
There was a problem hiding this comment.
This pattern may be fine in other places where we don't want to display a part of a backend response body to the user. Also backend responses are inconsistent right now (there's a backend ADR working on that), so they may be handled differently in different places.
In this case the display string we want to show is in an array in err.response.data[field_key]. We have to extract this in our try catch block higher up anyway, depending on whether this is an AxiosError.
Throwing an Error is firstly not great (it should be specific) and secondly it does not have the fields with the information, so this is removing necessary information.
Rethrowing the AxiosError as a generic error here creates a loss of information, where just surfacing the AxiosError is completely fine. And a line like catch (err) { throw err } serves no purpose.
There was a problem hiding this comment.
This pattern may be fine in other places where we don't want to display a part of a backend response body to the user.
I understand the use case for it, it's more of a question of where the error message formatting should live. This PR is moving the formatting for the errors from happening inside this data/apiHooks.ts file into tag-list/hooks.ts. I like that change, and think it likely makes sense to do something similar for some of the other hooks in this file like useImportPlan.
As I mentioned before, this isn't a blocking thing, just something that seems like it'd be worth looking into as a follow-up issue.
There was a problem hiding this comment.
Sure! I think so too.
If the error responses are becoming standardized on the backend, do you think it makes sense to wait for that so that we can handle them in the same way throughout the authoring frontend? Or do you think it's a smaller issue that should be done before then?
There was a problem hiding this comment.
I don't have a strong opinion on the timing. If it'll be easier to move away from the catch/rethrow pattern after the backend errors are standardized then waiting likely makes sense. I just want to make sure moving away from the pattern is tracked somewhere if it's something we plan on doing.
mgwozdz-unicon
left a comment
There was a problem hiding this comment.
PR looks great to me. I appreciate the small refactor to clean up the code. I tested it locally as well and appears to solve the issues. Once Brian's comments are addressed, I think it will be good to merge.
a952877 to
58ba86f
Compare
brian-smith-tcril
left a comment
There was a problem hiding this comment.
Thank you so much for working through this review with me!
I'm super happy with how this all came together!
Description
This fixes some issues discovered in openedx/modular-learning#272 .
Testing instructions
See linked issue for what to test
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'